From 0fae7b55e59313fe8f85b870958c8b9308922195 Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Tue, 27 Sep 2005 15:10:38 +0100 Subject: [PATCH] This patch adds a quick check to 'xm restore' that checks the existence and readability of the file given. This fixes the issue detected in xm-tests 03_restore_badparm_neg and 04_restore_badfilename_neg. Signed-off-by: Dan Smith Signed-off-by: Ewan Mellor --- tools/python/xen/xm/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 0db2e8636d..648c5968a7 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -188,6 +188,10 @@ def xm_restore(args): savefile = os.path.abspath(args[0]) + if not os.access(savefile, os.R_OK): + err("xm restore: Unable to read file %s" % savefile) + sys.exit(1) + from xen.xend.XendClient import server info = server.xend_domain_restore(savefile) PrettyPrint.prettyprint(info) -- 2.30.2